package com.xzy.demo.entry;


import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;


import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "testproperties")/*读取配置文件中的 对象*/
@Validated/*jsr-300 数据校验*/
public class TestProperties {


    private String id;
    private String name;
    private Integer age;
    private boolean sex;
    private Map<String,Object> map;
    private List<String> list;
    private String happy;

    public TestProperties() {
    }


    public TestProperties(String name, Integer age, boolean sex, Map<String, Object> map, List<String> list) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.map = map;
        this.list = list;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "TestProperties{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", map=" + map +
                ", list=" + list +
                ", happy='" + happy + '\'' +
                '}';
    }

    public String getHappy() {
        return happy;
    }

    public void setHappy(String happy) {
        this.happy = happy;
    }
}
